﻿using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Text;
using DataHelper;

namespace DAL
{
  public  class JjProcDao
    {
        public bool Update(SortedDictionary<string, string> sdList)
        {
            return new BuiltSQL().UpdateTable("Wage_JjProProcess", sdList);
        }
        public bool Insert(SortedDictionary<string, string> sdList)
        {
            return new BuiltSQL().InsertTable("Wage_JjProProcess", sdList);
        }
        public bool Delete(string procCode)
        {
            return SQLHelper.ExecuteSqlWithTransaction("Delete from Wage_JjProProcess Where ProcCode='" + procCode + "'");
        }
        public DataTable GetOneInfo(string procCode)
        {
            return SQLHelper.ExecuteSqlGetDrToDt("select * from Wage_JjProProcess Where ProcCode='" + procCode + "'");
        }
        public bool IsExist(string procCode)
        {
            DataTable dt = GetOneInfo(procCode);
            if (dt.Rows.Count > 0)
                return true;
            else
                return false;
        }
      //根据产品的代码，提取其工序
        public DataTable GetLists(string proCode)
        {
            string strSQL = " Select * from Wage_JjProProcess Where  ProCode ='" + proCode + "' order by procCode asc";
            return SQLHelper.ExecuteSqlGetDrToDt(strSQL);

        }
      //ddl
        public DataTable GetLists(string proCode, string statu)
        {
            string strSQL = " Select [Name],ProcCode as ID from Wage_JjProProcess Where  ProCode ='" + proCode + "' order by procCode asc";
            return SQLHelper.ExecuteSqlGetDrToDt(strSQL);

        }
    }
}
